import { Component } from 'react'
import { AtCurtain, AtButton } from 'taro-ui'

import "taro-ui/dist/style/components/curtain.scss";
import { View, Image } from '@tarojs/components'

export default class CustomCurtain extends Component {
    constructor(){
        super(...arguments)
        this.state = {
            // 是否显示帘幕
            isOpened: true,
            // 显示帘幕的图片
            curtainPng: "https://taro-ui.jd.com/h5/static/images/curtain.png"
        }
    }

    /**
     * 关闭帘幕
     */
    onClose(){
        this.setState({
            isOpened: false
        })
    }

    render(){
        const { isOpened, curtainPng } = this.state;
        return (
            <View>
                <AtCurtain
                    isOpened={isOpened}
                    onClose={this.onClose.bind(this)}
                >
                    <Image
                        style='width:100%;height:250px'
                        src={curtainPng}
                    >
                    </Image>
                </AtCurtain>
            </View>
        )
    }
}
